import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection<Student> alt = new ArrayList<>();
        alt.add(new Student("Jack",20));
        alt.add(new Student("Wu Yi fan",23));
        alt.add(new Student("Lily",25));


        Iterator<Student> it = alt.iterator();
        while(it.hasNext()){
            Student stu = it.next();
            System.out.println("Name:" + stu.getName() + "  age :" + stu.getAge());
        }
    }
}
